package com.example.aussiehealthhelper;

import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.button.MaterialButton;

public class DrugSearchActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drug_search);

        MaterialButton btnByName = findViewById(R.id.btnByName);
        MaterialButton btnBySymptom = findViewById(R.id.btnBySymptom);
        MaterialButton btnFavorites = findViewById(R.id.btnFavorites);
        MaterialButton btnManageDrugs = findViewById(R.id.btnManageDrugs);

        btnByName.setOnClickListener(v -> navigateToDrugNameSearch());
        btnBySymptom.setOnClickListener(v -> navigateToSymptomSearch());
        btnFavorites.setOnClickListener(v -> navigateToFavorites());
        btnManageDrugs.setOnClickListener(v -> navigateToManageDrugs());
    }

    private void navigateToDrugNameSearch() {
        Intent intent = new Intent(this, DrugNameSearchActivity.class);
        startActivity(intent);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    }

    private void navigateToSymptomSearch() {
        Intent intent = new Intent(this, SymptomSearchActivity.class);
        startActivity(intent);
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    private void navigateToFavorites() {
        Intent intent = new Intent(this, FavoriteDrugsActivity.class);
        startActivity(intent);
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    private void navigateToManageDrugs() {
        Intent intent = new Intent(this, DrugManagementActivity.class);
        startActivity(intent);
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    }
}